package cn.btks.resultintegration.rule.service.impl;

import cn.btks.resultintegration.rule.pojo.ProhibitProject;
import cn.btks.resultintegration.rule.repository.ProhibitProjectRepository;
import cn.btks.resultintegration.rule.service.ProhibitProjectService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Optional;

/**
 * @Author lijun
 * @Date 2021/2/23 10:21
 */
@Service
public class ProhibitProjectServiceImpl implements ProhibitProjectService {

    @Autowired
    ProhibitProjectRepository prohibitProjectRepository;

    @Override
    public List<ProhibitProject> findAll() {
        return prohibitProjectRepository.findAll();
    }

    @Override
    public ProhibitProject findById(Long id) {
        Optional<ProhibitProject> optional = prohibitProjectRepository.findById(id);
        if(optional.isPresent()){
            return optional.get();
        }
        return null;
    }

    @Override
    public List<ProhibitProject> findAllByCategoryId(Long categoryId) {
        return prohibitProjectRepository.findAllByCategoryId(categoryId);
    }
}
